package com.foxwho.springbootunittesting.junit.example;

import com.foxwho.springbootunittesting.model.Book;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.params.aggregator.ArgumentsAccessor;
import org.junit.jupiter.params.aggregator.ArgumentsAggregator;

import java.time.LocalDate;

public class BookAggregator implements ArgumentsAggregator {
    @Override
    public Book aggregateArguments(ArgumentsAccessor arguments, ParameterContext context) {
        return new Book(arguments.getInteger(0),
                arguments.getString(1),
                arguments.getString(2),
                arguments.get(3, LocalDate.class));
    }
}
